<?php

return [
    // 小程序权限配置 - 基于现有角色组ID
    'miniprogram_permissions' => [
        // 超级管理组 (ID: 1) - 拥有所有权限
        1 => [
            'name' => '超级管理组',
            'permissions' => [
                // 产品管理权限
                'product_manage' => [
                    'getProductList' => true,
                    'createProduct' => true,
                    'updateProduct' => true,
                    'deleteProduct' => true,
                ],
                // 型号管理权限
                'model_manage' => [
                    'getProductModelList' => true,
                    'createProductModel' => true,
                    'updateProductModel' => true,
                    'deleteProductModel' => true,
                ],
                // 工序管理权限
                'process_manage' => [
                    'getProcessList' => true,
                    'createProcess' => true,
                    'updateProcess' => true,
                    'deleteProcess' => true,
                ],
                // 工价管理权限
                'price_manage' => [
                    'getProcessPriceList' => true,
                    'createProcessPrice' => true,
                    'updateProcessPrice' => true,
                    'deleteProcessPrice' => true,
                    'batchProcessPrice' => true,
                ],
                // 订单管理权限
                'order_manage' => [
                    'getOrders' => true,
                    'getOrderDetail' => true,
                    'createOrder' => true,
                    'updateOrder' => true,
                    'deleteOrder' => true,
                ],
                // 分工管理权限
                'allocation_manage' => [
                    'getAllocations' => true,
                    'getAllocationDetail' => true,
                    'createAllocation' => true,
                    'batchCreateAllocation' => true,
                ],
                // 报工管理权限
                'report_manage' => [
                    'getReports' => true,
                    'getReportDetail' => true,
                    'auditReport' => true,
                    'getActiveReports' => true,
                    'getActiveReportDetail' => true,
                    'auditActiveReport' => true,
                ],
                // 基础数据权限
                'basic_data' => [
                    'getProducts' => true,
                    'getProcesses' => true,
                    'getUsers' => true,
                ],
                // 文件上传权限
                'file_upload' => [
                    'uploadAuditImage' => true,
                ],
            ]
        ],
        
        // 二级管理组 (ID: 2) - 部分权限
        2 => [
            'permissions' => [
                // 产品管理权限 - 只读
                'product_manage' => [
                    'getProductList' => true,
                    'createProduct' => false,
                    'updateProduct' => false,
                    'deleteProduct' => false,
                ],
                // 型号管理权限 - 只读
                'model_manage' => [
                    'getProductModelList' => true,
                    'createProductModel' => false,
                    'updateProductModel' => false,
                    'deleteProductModel' => false,
                ],
                // 工序管理权限 - 只读
                'process_manage' => [
                    'getProcessList' => true,
                    'createProcess' => false,
                    'updateProcess' => false,
                    'deleteProcess' => false,
                ],
                // 工价管理权限 - 只读
                'price_manage' => [
                    'getProcessPriceList' => true,
                    'createProcessPrice' => false,
                    'updateProcessPrice' => false,
                    'deleteProcessPrice' => false,
                    'batchProcessPrice' => false,
                ],
                // 订单管理权限 - 完整权限
                'order_manage' => [
                    'getOrders' => true,
                    'getOrderDetail' => true,
                    'createOrder' => true,
                    'updateOrder' => true,
                    'deleteOrder' => true,
                ],
                // 分工管理权限 - 完整权限
                'allocation_manage' => [
                    'getAllocations' => true,
                    'getAllocationDetail' => true,
                    'createAllocation' => true,
                    'batchCreateAllocation' => true,
                ],
                // 报工管理权限 - 完整权限
                'report_manage' => [
                    'getReports' => true,
                    'getReportDetail' => true,
                    'auditReport' => true,
                    'getActiveReports' => true,
                    'getActiveReportDetail' => true,
                    'auditActiveReport' => true,
                ],
                // 基础数据权限
                'basic_data' => [
                    'getProducts' => true,
                    'getProcesses' => true,
                    'getUsers' => true,
                ],
                // 文件上传权限
                'file_upload' => [
                    'uploadAuditImage' => true,
                ],
            ]
        ],
        
        // 三级管理组 (ID: 3) - 有限权限
        3 => [
            'name' => '三级管理组',
            'permissions' => [
                // 产品管理权限 - 只读
                'product_manage' => [
                    'getProductList' => true,
                    'createProduct' => false,
                    'updateProduct' => false,
                    'deleteProduct' => false,
                ],
                // 型号管理权限 - 只读
                'model_manage' => [
                    'getProductModelList' => true,
                    'createProductModel' => false,
                    'updateProductModel' => false,
                    'deleteProductModel' => false,
                ],
                // 工序管理权限 - 只读
                'process_manage' => [
                    'getProcessList' => true,
                    'createProcess' => false,
                    'updateProcess' => false,
                    'deleteProcess' => false,
                ],
                // 工价管理权限 - 只读
                'price_manage' => [
                    'getProcessPriceList' => true,
                    'createProcessPrice' => false,
                    'updateProcessPrice' => false,
                    'deleteProcessPrice' => false,
                    'batchProcessPrice' => false,
                ],
                // 订单管理权限 - 只读
                'order_manage' => [
                    'getOrders' => true,
                    'getOrderDetail' => true,
                    'createOrder' => false,
                    'updateOrder' => false,
                    'deleteOrder' => false,
                ],
                // 分工管理权限 - 只读
                'allocation_manage' => [
                    'getAllocations' => true,
                    'getAllocationDetail' => true,
                    'createAllocation' => false,
                    'batchCreateAllocation' => false,
                ],
                // 报工管理权限 - 审核权限
                'report_manage' => [
                    'getReports' => true,
                    'getReportDetail' => true,
                    'auditReport' => true,
                    'getActiveReports' => true,
                    'getActiveReportDetail' => true,
                    'auditActiveReport' => true,
                ],
                // 基础数据权限
                'basic_data' => [
                    'getProducts' => true,
                    'getProcesses' => true,
                    'getUsers' => true,
                ],
                // 文件上传权限
                'file_upload' => [
                    'uploadAuditImage' => true,
                ],
            ]
        ],
        
        // 二级管理组2 (ID: 4) - 特定权限
        4 => [
            'name' => '二级管理组2',
            'permissions' => [
                // 产品管理权限 - 完整权限
                'product_manage' => [
                    'getProductList' => true,
                    'createProduct' => true,
                    'updateProduct' => true,
                    'deleteProduct' => true,
                ],
                // 型号管理权限 - 完整权限
                'model_manage' => [
                    'getProductModelList' => true,
                    'createProductModel' => true,
                    'updateProductModel' => true,
                    'deleteProductModel' => true,
                ],
                // 工序管理权限 - 完整权限
                'process_manage' => [
                    'getProcessList' => true,
                    'createProcess' => true,
                    'updateProcess' => true,
                    'deleteProcess' => true,
                ],
                // 工价管理权限 - 完整权限
                'price_manage' => [
                    'getProcessPriceList' => true,
                    'createProcessPrice' => true,
                    'updateProcessPrice' => true,
                    'deleteProcessPrice' => true,
                    'batchProcessPrice' => true,
                ],
                // 订单管理权限 - 只读
                'order_manage' => [
                    'getOrders' => true,
                    'getOrderDetail' => true,
                    'createOrder' => false,
                    'updateOrder' => false,
                    'deleteOrder' => false,
                ],
                // 分工管理权限 - 只读
                'allocation_manage' => [
                    'getAllocations' => true,
                    'getAllocationDetail' => true,
                    'createAllocation' => false,
                    'batchCreateAllocation' => false,
                ],
                // 报工管理权限 - 只读
                'report_manage' => [
                    'getReports' => true,
                    'getReportDetail' => true,
                    'auditReport' => false,
                    'getActiveReports' => true,
                    'getActiveReportDetail' => true,
                    'auditActiveReport' => false,
                ],
                // 基础数据权限
                'basic_data' => [
                    'getProducts' => true,
                    'getProcesses' => true,
                    'getUsers' => true,
                ],
                // 文件上传权限
                'file_upload' => [
                    'uploadAuditImage' => false,
                ],
            ]
        ],
        
        // 三级管理组2 (ID: 5) - 最小权限
        5 => [
            'name' => '三级管理组2',
            'permissions' => [
                // 产品管理权限 - 只读
                'product_manage' => [
                    'getProductList' => true,
                    'createProduct' => false,
                    'updateProduct' => false,
                    'deleteProduct' => false,
                ],
                // 型号管理权限 - 只读
                'model_manage' => [
                    'getProductModelList' => true,
                    'createProductModel' => false,
                    'updateProductModel' => false,
                    'deleteProductModel' => false,
                ],
                // 工序管理权限 - 只读
                'process_manage' => [
                    'getProcessList' => true,
                    'createProcess' => false,
                    'updateProcess' => false,
                    'deleteProcess' => false,
                ],
                // 工价管理权限 - 只读
                'price_manage' => [
                    'getProcessPriceList' => true,
                    'createProcessPrice' => false,
                    'updateProcessPrice' => false,
                    'deleteProcessPrice' => false,
                    'batchProcessPrice' => false,
                ],
                // 订单管理权限 - 只读
                'order_manage' => [
                    'getOrders' => true,
                    'getOrderDetail' => true,
                    'createOrder' => false,
                    'updateOrder' => false,
                    'deleteOrder' => false,
                ],
                // 分工管理权限 - 只读
                'allocation_manage' => [
                    'getAllocations' => true,
                    'getAllocationDetail' => true,
                    'createAllocation' => false,
                    'batchCreateAllocation' => false,
                ],
                // 报工管理权限 - 只读
                'report_manage' => [
                    'getReports' => true,
                    'getReportDetail' => true,
                    'auditReport' => false,
                    'getActiveReports' => true,
                    'getActiveReportDetail' => true,
                    'auditActiveReport' => false,
                ],
                // 基础数据权限
                'basic_data' => [
                    'getProducts' => true,
                    'getProcesses' => true,
                    'getUsers' => true,
                ],
                // 文件上传权限
                'file_upload' => [
                    'uploadAuditImage' => false,
                ],
            ]
        ],
    ],
    
    // 权限检查配置
    'permission_check' => [
        'enable' => true, // 是否启用权限检查
        'log_permission_denied' => true, // 是否记录权限拒绝日志
        'default_group_id' => 5, // 默认管理组ID（当无法获取时使用）
        'super_admin_group_id' => 1, // 超级管理员组ID
    ],
];
